# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=racktables
_pkgname=RackTables
pkgver=0.22.0
pkgrel=2
pkgdesc="Server room asset management"
url="http://racktables.org"
arch="noarch"
license="GPL-2.0-only BSD-3-Clause MIT CC-BY-SA-3.0 Custom"
_php=php82
depends="$_php $_php-bcmath $_php-gd $_php-mysqli $_php-pdo_mysql
	$_php-opcache $_php-mbstring"
subpackages="$pkgname-doc"
pkggroups="www-data"
source="https://github.com/RackTables/racktables/archive/RackTables-$pkgver.tar.gz
	fix-php81.patch"
options="!check" # no test suite
builddir="$srcdir"/$pkgname-$_pkgname-$pkgver

package() {
	export prefix="/usr/share/webapps"
	export datadir="$prefix"
	export docdir="/usr/share/doc/RackTables"
	make DESTDIR="$pkgdir" install
	make DESTDIR="$pkgdir" install-docs
	mkdir -p "$pkgdir"/etc/racktables
	touch "$pkgdir"/etc/racktables/secret.php
	chown -R :www-data "$pkgdir"/etc/racktables
	chmod 770 "$pkgdir"/etc/racktables
	sed -i "s%<?php%<?php\n\n\$racktables_confdir = '/etc/racktables';%" \
	 "$pkgdir"/usr/share/webapps/RackTables/wwwroot/index.php
}

sha512sums="
b5f3d646eabdb23ea825a9923d626b080cb262012af9ae26542d9439ccbf71f845737288526b3f589f023fcb55166518e58dff028d2abc97032544ed01b11118  RackTables-0.22.0.tar.gz
407a934e9ff496c2bed74f178475a4c2cf58ba76d7b61320923b66d5bd92e58d7d902f0c3356e971f7f66c0b2bfa67bcdc3e369fdc170d137421fd24924d3dfa  fix-php81.patch
"
